import { DescItem } from '/@/components/Description/index';
import { BasicUpload } from '/@/components/Upload'
import { TypographyParagraph } from 'ant-design-vue'

// 水表信息
export function getWaterInfoDesConfig(): DescItem[] {
  return [
    {
      field: 'user_meter_code',
      label: '表身码',
    },
    {
      field: 'diameter_name',
      label: '口径',
    },
    {
      field: 'factory_name',
      label: '生产厂商',
    },
    {
      field: 'meter_module_code',
      label: '型号',
    },
    {
      field: 'meter_type_name',
      label: '水表类型',
    },
    {
      field: 'meter_use',
      label: '水表用途',
    },
    {
      field: 'display_name',
      label:  '抄表周期',
    },
    {
      field: 'location_description',
      label: '装表位置',
    },
  ];
}

// 备注信息
export function getRemarksSchemasConfig(): DescItem[] {
  return [
    {
      field: 'full_name',
      label: '申请人名称',
    },
    {
      field: 'cell_phone',
      label: '申请人手机号',
    },
    {
      field: 'field6',
      label: '申请人证件',
      render: (val) => {
        return <BasicUpload
          style={'marginTop: -5px'}
          value={val} 
          api={() => {}}
          maxSize={20}
          maxNumber={10}
          name={'uploadFile'}
          disabled={true}
          hidePreviewDeleteBtn={true}
          isHideUploadBtn={true}
        />
      },
    },
    {
      field: 'apply_reasons',
      label: '备注',
      render: (val) => {
        const ellipsis = { rows: 2, tooltip: val }
        return <TypographyParagraph
          ellipsis={ellipsis}
          content={val}
        />
      }
    },
    {
      field: 'field11',
      label: '附件',
      render: (val) => {
        return <BasicUpload
          style={'marginTop: -5px'}
          value={val} 
          api={() => {}}
          maxSize={20}
          maxNumber={10}
          name="uploadFile"
          disabled={true}
          hidePreviewDeleteBtn={true}
          isHideUploadBtn={true}
        />
      },
    },
    {
      field: 'application_date',
      label: '申请时间',
    },
    {
      field: 'operation_user',
      label: '操作人员',
    },
  ];
}

// 办理账户信息
export function getHandleAccountDesConfig(userinfo): DescItem[] {
  return [
    {
      field: 'user_code',
      label: '账户编号',
      render: (text) => {
        return text || '-';
      },
    },
    {
      field: 'full_name',
      label: `${userinfo.user_category_id === 1 ? '公司名称' : '户主名称'}`,
      render: (text) => {
        return text || '-';
      },
    },
    {
      field: 'home_address',
      label: '用水地址',
      render: (text, data) => {
        return text || '-';
      },
    },
    {
      field: 'water_usage_name',
      label: '用水性质',
      render: (text, data) => {
        return text || '-';
      },
    },
    {
      field: 'family_number',
      label: '用水人口',
      render: (text) => {
        return (text || text === 0) ? text + '人' : '-';
      },
    },
    {
      field: 'cell_phone',
      label: '手机号码',
      render: (text, data) => {
        return text || '-';
      },
    },
  ];
}

